package com.zggk.framework.dao.file;

import java.util.List;

import javax.persistence.Table;
import javax.transaction.Transactional;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import com.platform.framework.entity.file.BaseFileEntity;

@Repository  
@Table(name = "base_file_entity", catalog = "BASIC")   
public interface BaseFileEntityRepository extends JpaRepository<BaseFileEntity, String>,JpaSpecificationExecutor<BaseFileEntity>{
	
	/**
	 * 
	  * @Description 根据文件的md5信息查询是否有重复文件
	  * @author 杜天[dutian] Email:13594731440@163.com Tel:17600471932
	  * @param md5
	  * @return
	 */
    BaseFileEntity findByFileMd5(String md5);  
    
    
    @Query(value="select DISTINCT file_directory from  basic.base_file_entity",nativeQuery=true)
	String[] findFileDirectory(); 
    
    
    @Query(value="select DISTINCT file_directory,file_path from  basic.base_file_entity",nativeQuery=true)
	String[] findFilePath(); 
    
    @Query(value="select * from  basic.base_file_entity",nativeQuery=true)
    List<BaseFileEntity> getBaseFileEntity();
    
    
    
    
	/**
	 * 
	  * 描述： .
	  * @author 王求卿[wangqiuqing] Tel18101037995
	  * @param postid
	  * @param userCode
	  * @return
	 */
   @Transactional
   @Modifying
   @Query(value="update basic.fw_right_user set post_id = ?1  where user_code = ?2",nativeQuery = true)
   public int updatepostid(String post_id,String user_code);

   
    
    
}
